<template>
	<div class="assignee-container">
		<!-- 类型 -->
		<template v-if="type === TaskTypeEnum.TRANSFER">
			<el-avatar :size="36" color="#1989fa" style="background-color: #1989fa">
				<svg-icon color="#FFF" style="font-size: 20px" icon-class="flow-publish" class-name="svg-icon" />
			</el-avatar>
		</template>
		<template v-else-if="status === 1">
			<el-avatar :size="36" style="background-color: #3f73f6">
				<svg-icon color="#FFF" style="font-size: 32px" icon-class="flow-approval" class-name="svg-icon" />
			</el-avatar>
		</template>
		<template v-else>
			<flow-node-avatar :size="36" :show-name="false" :name="name" />
		</template>

		<!-- 状态 -->
		<div class="badge">
			<template v-if="type === 0">
				<svg-icon icon-class="comment" />
			</template>
			<template v-else-if="type === 1">
				<svg-icon icon-class="approval" />
			</template>
			<template v-else-if="type === 2">
				<svg-icon icon-class="auto-copy" />
			</template>
			<template v-else-if="type === 3">
				<svg-icon icon-class="approval" />
			</template>
			<template v-else-if="type === 4">
				<svg-icon icon-class="reject" />
			</template>
			<template v-else-if="type === 5">
				<svg-icon icon-class="claim" />
			</template>
			<template v-else-if="type === 6">
				<svg-icon icon-class="transfer" />
			</template>
			<template v-else-if="type === 7">
				<svg-icon icon-class="delegate" />
			</template>
			<template v-else-if="type === 8">
				<svg-icon icon-class="auto-jump" />
			</template>
			<template v-else-if="type === 9">
				<svg-icon icon-class="reclaim" />
			</template>
			<template v-else-if="type === 10">
				<svg-icon icon-class="resume" />
			</template>
			<template v-else-if="type === 15">
				<svg-icon icon-class="cancel" />
			</template>
			<template v-else-if="type === 16">
				<svg-icon icon-class="terminate" />
			</template>
			<template v-else-if="type === 17">
				<svg-icon icon-class="timeout" />
			</template>
			<template v-else-if="type === 18">
				<svg-icon icon-class="delegate-return" />
			</template>
			<template v-else-if="type === 19">
				<svg-icon icon-class="auto-jump" />
			</template>
			<template v-else-if="type === 20">
				<svg-icon icon-class="auto-complete" />
			</template>
			<template v-else-if="type === 21">
				<svg-icon icon-class="auto-reject" />
			</template>
			<template v-else-if="type === 22">
				<svg-icon icon-class="call-process" />
			</template>
			<template v-else>
				<svg-icon icon-class="in-progress" />
			</template>
		</div>
	</div>
</template>

<script setup lang="ts">
import SvgIcon from '../SvgIcon/index.vue'
import FlowNodeAvatar from './FlowNodeAvatar.vue'
import { TaskTypeEnum } from './enums'

defineProps({
	status: { type: Number, default: 0 },
	type: { type: Number, default: 0 },
	name: { type: String, default: '' }
})
</script>

<style lang="scss" scoped>
.assignee-container {
	position: relative;
	top: -5px;
	left: -13px;

	.badge {
		$BadgeSize: 18px;
		$BadgeOffset: -4px;
		position: absolute;
		width: $BadgeSize;
		height: $BadgeSize;
		display: flex;
		align-items: center;
		justify-content: center;
		bottom: $BadgeOffset;
		right: $BadgeOffset;
		z-index: 999;
		border: 2px solid #fff;
		background-color: #fff;
		border-radius: 50%;
		overflow: hidden;
	}

	.svg-icon {
		display: inline;
		font-size: 36px;
	}
}
</style>
